package db;

import java.sql.ResultSet;
//import javax.swing.JOptionPane;

public class test11 {
	public static void main(String[] args) {
			DBHelper help=new DBHelper();
			if(help.TestConn())
				System.out.println("连接成功1");
			else
				System.out.println("连接失败1");
			
			//JOptionPane.showMessageDialog(null, "hello world");
			
			//String sSQL="select * from w_brand where id=? and brand_name =?";
			
//			String sSQL="select * from blog";
//			Object[] oParams=new Object[1];
//			oParams[0]=5;
//			//oParams[1]="柔";
//			
//			ResultSet rs=help.GetResultSet(sSQL, oParams);
//			try
//			{
//				if(rs.next())
//					System.out.println("id: " + rs.getString(1) + " brand_name: " + rs.getString(2));
//					////索引从1开始
//			}catch(Exception ex)
//			{
//				System.out.println(ex.getMessage());
//			}finally
//			{
//				try
//				{
//					rs.close();
//				}catch(Exception ex)
//				{
//					System.out.println(ex.getMessage());
//				}
//			}

			//DataTable dt=help.GetDataTable(sSQL,oParams);
			
			String sSQL="select * from blog";
			DataTable dt=help.GetDataTable(sSQL);			
			try
			{
				 int iRowCount = dt.RowCount;
				 int iColumnCount = dt.ColumnCount;
				 System.out.println("行数:" + iRowCount + ",列数:" + iColumnCount);
				 DataTable.PrintTable(dt);
				 //rs.last();
				//System.out.println("数据行：" + rs.getRow());
			}catch(Exception ex)
			{
				System.out.println("错误提示：" + ex.getMessage());
			}

	}
}

